<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script type="module">
	// import Promise from "./index.js";
    // all接收的是一个数组,数组的元素一般为Promise实例.
    // 数组中的所有的Promise实例状态均为成功,才成功.
    // 成功值为数组中所有的成功状态组成的数组
    const p1 = new Promise(function(resolve,reject){
		setTimeout(()=>{
			resolve(100)
        },700)
    })
	const p2 = new Promise(function(resolve,reject){
		setTimeout(()=>{
			resolve(200)
		},500)
	})
	const p3 = new Promise(function(resolve,reject){
		setTimeout(()=>{
			reject(300)
		},300)
	})
	const p4 = new Promise(function(resolve,reject){
		setTimeout(()=>{
			resolve(400)
		},600)
	})
    const p = Promise.all([p1,p2,p3,p4]);
    // const p = Promise.race([p1,p2,p3,p4]);
	console.log(p);// fulfilled [100,200,300,400]




</script>
</html>